import React, { Component } from 'react'

export default class Child extends Component {
  constructor(props) {
    super(props)
    console.log(this.props === props, 3333)
  }
  handleClick = () => {
    // this.props.salary = 18
    // this.setState({ salary: 18 })
    // 引用对象不能改
    // this.obj = {}
    // 引用对象里面的内容同样不能改
    // this.obj.age = 1999
  }
  render() {
    const { salary, obj, name, bBar, age, fn, jsxEle } = this.props
    return (
      <div>
        <p>Child: {salary}</p>
        <p>{obj.age}</p>
        <p>name: {name}</p>
        <p>bBar: {typeof bBar}</p>
        <p>age: {typeof age}</p>
        {jsxEle}
        <button onClick={this.handleClick}>修改 salary</button>
        <button onClick={fn}>调用函数</button>
        <button onClick={() => fn()}>调用函数1</button>
      </div>
    )
  }
}

/* const Child = (props) => {
  return <div>Child: {props.salary}</div>
}

export default Child */
